package android.ly;

import java.util.List;

import android.app.Activity;
import android.ly.util.MyUtil;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.TextView;
import android.xml.XmlPojo;

public class MyDialogActivity extends Activity implements Runnable {
	// private PopupWindow popupWindow;
	private Handler handler;
	private TextView tv;
	private int i = 0;
	private List<XmlPojo> list;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.textviewdemo);

		Log.d("debug", "" + MyUtil.getVerCode(getApplicationContext()));
		Log.d("debug", MyUtil.getVerName(getApplicationContext()));

		//RTMPUtil.librtmp("rtmp://121.52.214.197:1935/vod/test1");
		
//		URL url;
//		try {
//			url = new URL(
//					"http://www.google.com.hk/ig/api?hl=zh-cn&ie=utf-8&weather=beijing");
//			InputStream in = url.openConnection().getInputStream();
//			XmlHandler xmlHandler = new XmlHandler();
//			android.util.Xml.parse(in, Encoding.ISO_8859_1, xmlHandler);
//			list = xmlHandler.getList();
//		} catch (MalformedURLException e) {
//			e.printStackTrace();
//		} catch (IOException e) {
//			e.printStackTrace();
//		} catch (SAXException e) {
//			e.printStackTrace();
//		}
//
//		handler = new Handler();
//		handler.postDelayed(this, 300);

	}

	@Override
	public void run() {
		Log.d("debug", list.size() + " " + i);
		if (i < list.size()) {
			XmlPojo xp = list.get(i);
			tv.setText(i + " : " + xp.getDay() + " : " + xp.getCondition()
					+ " : " + xp.getHigh());
			i++;
			handler.postDelayed(this, 1000);
		}
	}
}